#include <dice\dice.h>

#include <cstdio>

#include "roger.h"
#include "action.h"
#include "dialog.h"

AI_roger::AI_roger(){}
AI_roger::~AI_roger(){}

void AI_roger::exec_AI(){
    if( !parentMap ){
        actor::exec_AI();
        return;
    }
    if( D(500) == 1 ){
        printf("NAI: add Dial\n");
        parentMap->dialogMutex.lock();
            switch(D(3)){
                case 1: parentMap->addDialog(new dialog("Je m'appelle Roger !",this)); break;
                case 2: parentMap->addDialog(new dialog("Meuhporg !",this)); break;
                case 3: parentMap->addDialog(new dialog("1337 powaaaaaaaa !!! xD",this)); break;
            }
        parentMap->dialogMutex.unlock();
    }

    printf("NAI: setMove\n");
    if( !move( D(6)-1, 1 ) ){
        curaction = new action_idle(this);
        curaction->setDuration(500);
    }
}
